package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.model.product.BaseTrademark;
import com.atguigu.gmall.product.mapper.BaseTrademarkMapper;
import com.atguigu.gmall.product.service.BaseTrademarkService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Sanmier
 * @create 2020-12-01 14:25
 */
//实现了iservice的方法
@Service
public class BaseTrademarlServiceImpl extends ServiceImpl<BaseTrademarkMapper, BaseTrademark> implements BaseTrademarkService {

    @Autowired
    private BaseTrademarkMapper baseTrademarkMapper;

    //分页查询品牌列表
    @Override
    public IPage getBaseTrademarkList(Page<BaseTrademark> objectPage) {
        // select * from base_tademark where order by id desc;
        QueryWrapper<BaseTrademark> objectQueryWrapper = new QueryWrapper<>();
        //设置一个排序规则！ mysql默认的排序规则是啥？desc/asc
        objectQueryWrapper.orderByDesc("id");
        return baseTrademarkMapper.selectPage(objectPage,objectQueryWrapper);
    }
}
